package com.google.gwt.livinglife.server.data;

import java.util.ArrayList;
import java.util.List;

import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.Inheritance;
import javax.jdo.annotations.InheritanceStrategy;
import javax.jdo.annotations.Order;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.Extension;

import com.google.gwt.livinglife.client.data.ResponseData;


@PersistenceCapable(identityType = IdentityType.APPLICATION)
@Inheritance(customStrategy = "complete-table")
public class Response extends BasicPostWithStats {
	@Persistent
	private Long challenge;

	@Persistent
	@Order(extensions = @Extension(vendorName="datanucleus", key="list-ordering", value="date asc"))
	private List<Long> comments = new ArrayList<Long>();
	
	public Response(ResponseData responseData) {
		super(responseData);
		challenge = responseData.getChallenge();
		for (int i = 0; i < responseData.getComments().size(); ++i) {
			comments.add(responseData.getComments().get(i).getId());	
		}
	}

	public Long getChallenge() {
		return challenge;
	}

	public void setChallenge(Long challenge) {
		this.challenge = challenge;
	}

	public List<Long> getComments() {
		return comments;
	}

	public void setComments(List<Long> comments) {
		this.comments = comments;
	}
	
}
